package com.znh.kuiklyuniversity.compose.widgets

import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import com.tencent.kuikly.compose.foundation.clickable
import com.tencent.kuikly.compose.foundation.interaction.MutableInteractionSource
import com.tencent.kuikly.compose.foundation.interaction.collectIsPressedAsState
import com.tencent.kuikly.compose.foundation.layout.height
import com.tencent.kuikly.compose.foundation.layout.width
import com.tencent.kuikly.compose.material3.Button
import com.tencent.kuikly.compose.material3.Text
import com.tencent.kuikly.compose.ui.Modifier
import com.tencent.kuikly.compose.ui.graphics.Color
import com.tencent.kuikly.compose.ui.unit.dp
import com.znh.kuiklyuniversity.backgroundColor

@Composable
fun buttomSelect(){

    val interactionSource = remember { MutableInteractionSource() }
    val isPressed by interactionSource.collectIsPressedAsState()

    // 状态变化回调（可选）
//    LaunchedEffect(isPressed) {
//        onPressedChange(isPressed)
//    }
    Button(
        modifier = Modifier
            .clickable(
                onClick = {},
                interactionSource = interactionSource,
                indication = null, // 不使用默认波纹效果
            )
            .height(100.dp)
            .width(36.dp)
            .backgroundColor(
                if (isPressed) Color.Blue
                else Color.Gray
            ),
        onClick = {},
    ) {
            Text("按钮")
    }
}